package com.seanchenxi.gwt.wordpress.xmlrpc.service;

import java.util.ArrayList;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.seanchenxi.gwt.wordpress.domain.model.Category;
import com.seanchenxi.gwt.wordpress.domain.model.FileData;
import com.seanchenxi.gwt.wordpress.domain.model.Post;
import com.seanchenxi.gwt.wordpress.domain.model.PostEditor;
import com.seanchenxi.gwt.wordpress.domain.model.WpFile;

/**
 * The Interface MetaWeblogService.
 */
public interface MetaWeblogServiceAsync {

	/*
	 *  MetaWeblog API (with MT extensions to structs)
	 */
	
	/**
	 * New post.
	 *
	 * @param blogId the blog id
	 * @param username the user name
	 * @param password the password
	 * @param postCreator the post creator
	 * @param publish the publish
	 * @param callback the call back
	 */
	void newPost(int blogId, String username, String password,
			PostEditor postCreator, boolean publish,
			AsyncCallback<Integer> callback);

	/**
	 * Edits the post.
	 *
	 * @param postId the post id
	 * @param username the user name
	 * @param password the password
	 * @param postEditor the post editor
	 * @param publish the publish
	 * @param callback the call back
	 */
	void editPost(int postId, String username, String password,
			PostEditor postEditor, boolean publish,
			AsyncCallback<Boolean> callback);

	/**
	 * Gets the post.
	 *
	 * @param postId the post id
	 * @param username the user name
	 * @param password the password
	 * @param callback the call back
	 * @return the post
	 */
	void getPost(int postId, String username, String password,
			AsyncCallback<Post> callback);

	/**
	 * Gets the recent posts.
	 *
	 * @param blogId the blog id
	 * @param username the user name
	 * @param password the password
	 * @param number the number
	 * @param callback the call back
	 * @return the recent posts
	 */
	void getRecentPosts(int blogId, String username, String password,
			int number, AsyncCallback<ArrayList<Post>> callback);

	/**
	 * Gets the categories.
	 *
	 * @param blogId the blog id
	 * @param username the user name
	 * @param password the password
	 * @param callback the call back
	 * @return the categories
	 */
	void getCategories(int blogId, String username, String password,
			AsyncCallback<ArrayList<Category>> callback);

	/**
	 * New media object.
	 *
	 * @param blogId the blog id
	 * @param username the user name
	 * @param password the password
	 * @param data the data
	 * @param callback the call back
	 */
	void newMediaObject(int blogId, String username, String password,
			FileData data, AsyncCallback<WpFile> callback);

	/*
	 *  MetaWeblog API aliases for Blogger API
	 *  see http://www.xmlrpc.com/stories/storyReader$2460
	 */
	/**
	 * Gets the template.
	 *
	 * @param blogId the blog id
	 * @param username the user name
	 * @param password the password
	 * @param callback the call back
	 * @return the template
	 */
	void getTemplate(int blogId, String username, String password,
			AsyncCallback<String> callback);

	/**
	 * Sets the template.
	 *
	 * @param blogId the blog id
	 * @param username the user name
	 * @param password the password
	 * @param content the content
	 * @param callback the call back
	 */
	void setTemplate(int blogId, String username, String password,
			String content, AsyncCallback<Boolean> callback);

	/**
	 * Delete post.
	 *
	 * @param postId the post id
	 * @param username the username
	 * @param password the password
	 * @param callback the call back
	 */
	void deletePost(int postId, String username, String password,
			AsyncCallback<Boolean> callback);

}
